import request from '@/utils/request'
import { identifierMatch } from 'js-beautify/js/src/javascript/acorn'

// 查询设备保养作业列表
export function listPreserveWork(query) {
  return request({
    url: '/device/preserveWork/list',
    method: 'get',
    params: query,
  })
}

// 查询设备保养作业详细
export function getPreserveWork(bylId) {
  return request({
    url: '/device/preserveWork/' + bylId,
    method: 'get',
  })
}

// "新增界面"所有设备查询（分页）
export function listDeviceAll(query) {
  return request({
    url: '/device/preserveWork/all',
    method: 'get',
    params: query,
  })
}

// 新增设备保养作业
export function addPreserveWork(data) {
  return request({
    url: '/device/preserveWork',
    method: 'post',
    data: data,
  })
}

// 修改设备保养作业
export function updatePreserveWork(data) {
  return request({
    url: '/device/preserveWork',
    method: 'put',
    data: data,
  })
}

// 删除设备保养作业
export function delPreserveWork(bylDjbhs) {
  return request({
    url: '/device/preserveWork/' + bylDjbhs,
    method: 'delete',
  })
}

// 导出设备保养作业
export function exportPreserveWork(query) {
  return request({
    url: '/device/preserveWork/export',
    method: 'get',
    params: query,
  })
}

// 上传文件
export function uploadPreserveWork(data) {
  return request({
    url: '/device/preserveWork/upload',
    method: 'post',
    data: data,
  })
}

// 清除上传文件
export function clearPreserveWork(bylCode) {
  return request({
    url: '/device/preserveWork/clear',
    method: 'delete',
    params: {
      bylCode: bylCode,
    },
  })
}

// 保养完成操作
export function finishPreserveWork(data) {
  return request({
    url: '/device/preserveWork/preserveFinish',
    method: 'put',
    data: data,
  })
}

// 根据模具编号查询
export function listMoldDetail(mjmMjbh) {
  return request({
    url: '/device/preserveWork/moldDetail',
    method: 'get',
    params: {
      bylCode: mjmMjbh,
    },
  })
}

// 获取保养单号信息
export function listPreserveInfo(id) {
  return request({
    url: '/device/preserveWork/getPreserveInfo/' + id,
    method: 'get',
  })
}

// 获取保养单号设备信息
export function listPreserveDevice(id, type) {
  return request({
    url: '/device/preserveWork/getPreserveDevice/' + id + '/' + type,
    method: 'get',
  })
}

// 获取保养内容
export function listPreserveContext(id, type) {
  return request({
    url: '/device/preserveWork/getPreserveWork/' + id + '/' + type,
    method: 'get',
  })
}

// 删除恢复精度工作
export function removeRecoveryAccuracy(bylDjbhs) {
  return request({
    url: '/device/preserveWork/removeRecoveryAccuracy/' + bylDjbhs,
    method: 'delete',
  })
}

// 增加恢复精度工作
export function addRecoveryAccuracy(data) {
  return request({
    url: '/device/preserveWork/addRecoveryAccuracy',
    method: 'post',
    data: data,
  })
}

//更新修改框上部分内容
export function updatePreserveInfo(data) {
  return request({
    url: '/device/preserveWork/updatePreserveInfo',
    method: 'put',
    data: data,
  })
}
//更新修改框下部分内容
export function updatePreserveContext(data) {
  return request({
    url: '/device/preserveWork/updatePreserveContext',
    method: 'put',
    data: data,
  })
}
